<?php 
    include("header.php");
?>

<head>
    <title>Liga - Poll</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="assets/css/default.css" rel="stylesheet" type="text/css">

    <style type="text/css">
        @import "/assets/js/dojo-release-1.1.0/dijit/themes/tundra/tundra.css";
        @import "/assets/js/dojo-release-1.1.0/dojo/resources/dojo.css"
    </style>
    
    <script type="text/javascript" src="/assets/js/dojo-release-1.1.0/dojo/dojo.js"
      djConfig="parseOnLoad: true"></script>
    
    <script type="text/javascript">
        dojo.require("dijit.Dialog");
        dojo.require("dijit.form.TextBox");
        dojo.require("dijit.form.Button");
    </script>

</head>

<?php 
    setTabIndex(1);
    createBody("default");

    $user = $_SESSION['user'];
    
    mysql_connect(DB_SERVER, DB_USER, DB_PWD);
    mysql_select_db(DB_CATALOG);
    
    $result = mysql_query("select p.* from poll p where p.isActive = 1");
    
    $polls = array();
    while ($row = mysql_fetch_assoc($result)) {
        $poll = new Poll;
        $poll->poll_id = $row['poll_id'];
        $poll->title = $row['title'];
        $poll->desc = $row['descr'];
        $poll->start = $row['start'];
        $poll->end = $row['end'];
        $poll->active = $row['active'];
        array_push($polls, $poll);
    }
    
    $activePoll = $polls[0];
    
    $result = mysql_query("select po.* from poll_option po where po.poll_id = ".$activePoll->poll_id);

    $title = urlencode("It's an example!");
    $chs = "450x225";
    $chd = "t:60|20|80";
    $chdl = "First|Second|Third";
    $chco = "FF000099,00FF0099,0000FF99";

    // Here's where we call the chart, and return the encoded chart data
    //echo "<img src=http://chart.apis.google.com/chart?chtt=".$title."&cht=bvg&chs=".$chs."&chd="
    //    .$chd."&chxt=y&chdl=".$chdl."&chco=".$chco;

?> 

<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0" bgcolor="#FFFFFF">

    <tr>
        <td id="leftFiller" valign="top" height="100%" rowspan="3" bgcolor="#006633">
            <table border="0" cellpadding="0" cellspacing="0" height="100%" width="8px">
                <tr><td>&nbsp;</td></tr>
            </table>
        </td>
        <td id="header" valign="top" width="100%">
            <table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#006633" width="70%">
                        <?php include("inc_title.html"); ?>
                    </td>
                    <td bgcolor="#006633" align="right">&nbsp;
                    <?php
                        if (isset($user)) {
                    ?>
                        <a href="insert_news_form.php"><img src="assets/images/16x16/add.gif" border="0" alt="Voeg nieuwsbericht toe"></a>
                        &nbsp;&nbsp;
                    <?php
                        }
                    ?>
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.html"); ?>   
                </tr>
                <tr><td colspan="3" nowrap bgcolor="#BCDD10" height="4"><img src="/assets/images/spacer.gif" alt="" height="1" width="1"></td></tr>
                <tr>
                    <td>&nbsp;</td>
                    <td width="90%" valign="top">
                        <table cellspacing="2" cellpadding="5" class="newsbox">
                        
                        </table>
                        </td>
                    <td width="5%">&nbsp;</td> 
                </tr>
            </table>
        </td>
    </tr>
</table>